﻿using System;
using Frame.Lib.Core.Tree;

namespace Frame.Lib.Core.Dept
{
    public partial class DeptInfo:TreeInfo
    {
        public override string GetTableName()
        {
            return "s_Dept";
        }
        public override string GetInsertSql()
        {
            return "insert into s_Dept ( [ID], [Name], [UpperID], [Depth], [Path], [Orders]) values ( @ID, @Name, @UpperID, @Depth, @Path, @Orders)";
        }
        public override string GetUpdateSql()
        {
            return "update s_Dept set  [Name] = @Name, [UpperID] = @UpperID, [Depth] = @Depth, [Path] = @Path, [Orders] = @Orders where ID = @ID";
        }

        public DeptInfo() { }

        public override void SetValue(string key, object value)
        {
            key = key.ToLower();
            switch (key)
            {
                case "id":
                    this.ID = (Int32)value;
                    break;
                case "name":
                    this.Name = (String)value;
                    break;
                case "upperid":
                    this.UpperID = (Int32)value;
                    break;
                case "depth":
                    this.Depth = (Int32)value;
                    break;
                case "path":
                    this.Path = (String)value;
                    break;
                case "orders":
                    this.Orders = (Int32)value;
                    break;
            }
        }
        public override object GetValue(string key)
        {
            key = key.ToLower();
            switch (key)
            {
                case "id":
                    return this.ID;
                case "name":
                    return this.Name;
                case "upperid":
                    return this.UpperID;
                case "depth":
                    return this.Depth;
                case "path":
                    return this.Path;
                case "orders":
                    return this.Orders;
                default:
                    return null;
            }
        }

    }
}
